home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 52 / Amiga Format AFCD52 (Issue 136, May 2000).iso / -serious- / programming / basic / mildred / lha / landtest2.lha / LandTest2.ascii < prev    next >
Text File  |  1998-12-13  |  3KB  |  154 lines

  1. WBStartup
  2. #Width=320
  3. #Height=240
  4. MCPU Processor
  5. Mc2pCPUmode Processor
  6.  
  7. Pic$="5Ms2.IFF"
  8. Land$="Land8.iff"
  9. #Objects=350
  10. #ObjWidth=16
  11. #ObjHeight=16
  12.  
  13. MReserveShapes 65
  14. InitBank 0,(2240+#Width)*60,$10002
  15. CludgeBitMap 0,2240+#Width,60,8,Bank(0)
  16. InitPalette 0,256
  17. LoadBitMap 0,Land$,0
  18. MReserveBitmaps 2
  19. MBitmap 0,2240+#Width,60
  20. MPlanar16ToBitmap 0,Bank(0),2240,60,2240+#Width,60
  21. MBlockScroll 0,0,#Width,60,2240,0,0
  22. MGetaShape 0,0,4,16,8
  23. MBitmap 1,#Width,#Height
  24. InitBank 0,#Width*#Height,$10002
  25. CludgeBitMap 0,#Width,#Height,8,Bank(0)
  26. Screen 0,8,0,#Width,#Height,8,0,"",0,0,0
  27. InitPalette 1,256
  28. LoadBitMap 0,Pic$,1
  29. For c=0 To 63
  30.   CopyColour 0,1,c,c
  31. Next c
  32. ShowPalette 1
  33. MReservec2pWindows 1
  34. Mc2pWindow 0,#Width,#Height
  35. MBitmapClip 1,0,0,#Width,#Height-60,On
  36. s=1
  37. For y=0 To 63 Step #ObjHeight
  38.   For x=0 To 63 Step #ObjWidth
  39.     If MShape(s,16,16)=0 Then End
  40.     For yy=y To y+#ObjHeight-1
  41.       For xx=64+x To 64+x+#ObjWidth-1
  42.         MPlotShape xx MOD #ObjWidth, yy MOD #ObjHeight, Point(xx,yy)
  43.       Next xx
  44.     Next yy
  45.     MMakeCookie s
  46.     s+1
  47.   Next x
  48. Next y
  49. Dim x.w(#Objects)
  50. Dim y.w(#Objects)
  51. Dim xdirection.b(#Objects)
  52. Dim ydirection.b(#Objects)
  53. Dim xdirectionswap.b(#Objects)
  54. Dim ydirectionswap.b(#Objects)
  55. For obj=1 To #Objects
  56.   x(obj)=Rnd(2220-36)+16
  57.   y(obj)=Rnd(#Height-100)+16
  58.   Repeat
  59.     xdirection(obj)=Rnd(8)-4
  60.   Until xdirection(obj)<>0
  61.   Repeat
  62.     ydirection(obj)=Rnd(6)-3
  63.   Until ydirection(obj)<>0
  64.   xdirectionswap(obj)=-xdirection(obj)
  65.   ydirectionswap(obj)=-ydirection(obj)
  66. Next obj
  67.  
  68. speedsetting.q=1 ; Global speed multiplier
  69. xpos.q=0
  70. xaccelerate.q=1*speedsetting
  71. xmomentum.q=0
  72. xairresistance.q=0.1*speedsetting
  73. xmaxspeed.q=16*speedsetting
  74. ypos.q=(#Height-69)/2
  75. yaccelerate.q=1*speedsetting
  76. ymomentum.q=0
  77. ymaxspeed.q=8*speedsetting
  78. ytopdampen.q=1.9*speedsetting
  79. ybottomdampen.q=1.65*speedsetting
  80. ygravity.q=0.15*speedsetting
  81. cnt.l=0
  82. ResetTimer
  83. While Joyb(1)=0
  84.  
  85.   jh=JHoriz(1)
  86.   jv=JVert(1)
  87.  
  88.   xmomentum+(xaccelerate*jh)
  89.   ymomentum+(yaccelerate*jv)
  90.  
  91.   ymomentum+ygravity
  92.   If xmomentum>0
  93.     xmomentum-xairresistance
  94.     If xmomentum<0 Then xmomentum=0
  95.   Else
  96.     xmomentum+xairresistance
  97.     If xmomentum>0 Then xmomentum=0
  98.   EndIf
  99.  
  100.   If xmomentum>xmaxspeed Then xmomentum=xmaxspeed
  101.   If xmomentum<-xmaxspeed Then xmomentum=-xmaxspeed
  102.   If ymomentum>ymaxspeed Then ymomentum=ymaxspeed
  103.   If ymomentum<-ymaxspeed Then ymomentum=-ymaxspeed
  104.  
  105.   xpos+xmomentum
  106.   ypos+ymomentum
  107.  
  108.   If ypos<0
  109.     ymomentum=-ymomentum/ytopdampen
  110.     ypos=0
  111.   EndIf
  112.   If ypos>#Height-69
  113.     ymomentum=-ymomentum/ybottomdampen
  114.     ypos=#Height-69
  115.   EndIf
  116.  
  117.   If xpos<0 Then xpos=2240+xpos
  118.   If xpos>=2240 Then xpos-2240
  119.  
  120.   cnt+1
  121.  
  122.   MCls0
  123.  
  124.   mult.q=1.0
  125.   For yy=0 To 59
  126.     xx=xpos*mult
  127.     If xx>2239 Then xx-2240
  128.     If xx<0 Then xx+2240
  129.     MScroll xx,yy,#Width,1,0,#Height-61+yy,0
  130.     mult*1.01
  131.   Next yy
  132.  
  133.   For obj=1 To #Objects
  134.     x(obj)+xdirection(obj)
  135.     If x(obj)<8 OR x(obj)>2200 Then Exchange xdirection(obj),xdirectionswap(obj)
  136.     y(obj)+ydirection(obj)
  137.     If y(obj)<8 OR y(obj)>#Height-84 Then Exchange ydirection(obj),ydirectionswap(obj)
  138.     If x(obj)>xpos AND x(obj)<xpos+#Width-16
  139.       MBlit (obj MOD 16)+1,x(obj)-xpos,y(obj) ; Stencil-cut blit and add to queue
  140.     EndIf
  141.   Next obj
  142.  
  143.   MBlit 0,160-8,ypos
  144.   Mc2p Bank(0)
  145.   VWait
  146. Wend
  147. ;t=Timer
  148. ;a.q=50.0/(t/cnt)
  149. ;NPrint a
  150. ;VWait 50
  151. ;MouseWait
  152. End
  153.  
  154.